﻿using System;
using System.IO.Ports;
using System.Text;

namespace Library.Gsm {
  public class SerialConnectionInfo : IConnectionInfo {
    public object Get(string name) {
      if (String.IsNullOrEmpty(name)) return null;
      name = name.ToLower();
      switch (name) {
        case "portname":
          return PortName;
        case "baudrate":
          return BaudRate;
        case "databits":
          return DataBits;
        case "stopbits":
          return StopBits;
        case "parity":
          return Parity;
        case "readtimeout":
          return ReadTimeOut;
        case "writetimeout":
          return WriteTimeOut;
        case "encoding":
          return Encoding;

      }

      throw new ArgumentException("Value not found for: " + name);
    }

    public string PortName { get; set; }
    public int BaudRate { get; set; }
    public int DataBits { get; set; }
    public StopBits StopBits { get; set; }
    public Parity Parity { get; set; }
    public int ReadTimeOut { get; set; }
    public int WriteTimeOut { get; set; }
    public Encoding Encoding { get; set; }
  }
}
